package com.wds.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author WDs , wds8.24@outlook.com
 * @version 1.0
 * @since 2022-12-04 22:55
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createDocket() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.wds.controller")).build();
    }

    private ApiInfo apiInfo() {
        Contact contact = new Contact("Wds", "http://reboots.top", "wds8.24@qq.com");
        return new ApiInfoBuilder()
                .contact(contact)
                .title("Blog 接口文档")
                .description("我的博客的接口文档 <br> 22/12/4 write")
                .version("1.1")
                .build();
    }
}
